{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "# Intro to SqlAlchemy 介绍 SqlAlchemy\r\n",
    "\r\n",
    "Last updated on July 27, 2020\r\n",
    "\r\n",
    "最后更新于2020年7月27日\r\n",
    "\r\n",
    "SQLAlchemy is a defacto framework for working with relational databases in Python. It was created by Mike Bayer in 2005. SQLAlchemy allows you to work with databases from different vendors like MySQL, MS-SQL, PostgreSQL, Oracle, SQLite, and many others.\r\n",
    "\r\n",
    "SQLAlchemy 是用 Python 处理关系数据库的事实框架。它是由迈克 · 拜耳于2005年创建的。SQLAlchemy 允许您使用来自不同供应商的数据库，比如 MySQL、 MS-SQL、 PostgreSQL、 Oracle、 SQLite 等等。\r\n",
    "\r\n",
    "# Why use SQLAlchemy 为什么要使用 SQLAlchemy\r\n",
    "\r\n",
    "The most exciting feature of SQLAlchemy is its ORM. An ORM or Object Relational Mapper allows us to work with database using Object Oriented code rather than writing SQL queries. Another great benefit we get from using a framework like SQLAlchemy is that no matter which database we use our underlying code will remain the same. This makes it easy to migrate from one database from another without rewriting the application code.\r\n",
    "\r\n",
    "SQLAlchemy 最令人兴奋的特性是它的 ORM。ORM 或对象关系映射器允许我们使用面向对象代码处理数据库，而不是编写 SQL 查询。使用像 SQLAlchemy 这样的框架的另一个好处是，无论我们使用哪个数据库，我们的底层代码都将保持不变。这使得从一个数据库迁移到另一个数据库变得容易，而无需重写应用程序代码。\r\n",
    "\r\n",
    "SQLAlchemy has another component called SQLAlchemy Core. The Core is just a smooth abstraction over the traditional SQL. The Core provides a SQL Expression Language which allows us to generate SQL statements using Python constructs. Unlike ORM which revolves around model and objects, SQL Expression revolves around tables, columns, indexes etc (just like plain old SQL). SQL Expression Language closely resembles SQL but it is standardized so that you can use it across many different databases. You can use SQLAlchemy ORM and SQLAlchemy Core independently or together depending upon what you want to accomplish. Behind the scenes, SQLAlchemy ORM uses SQLAlchemy Core.\r\n",
    "\r\n",
    "SQLAlchemy 有另一个名为 SQLAlchemy Core 的组件。核心仅仅是对传统 SQL 的一个顺利的抽象。Core 提供了一种 SQL 表达式语言，它允许我们使用 Python 结构生成 SQL 语句。与围绕模型和对象运行的 ORM 不同，SQL 表达式围绕表、列、索引等(就像普通的老式 SQL)运行。SQL 表达式语言与 SQL 非常相似，但是它是标准化的，因此您可以在许多不同的数据库中使用它。您可以根据需要独立或一起使用 SQLAlchemy ORM 和 SQLAlchemy Core。在幕后，SQLAlchemy ORM 使用 SQLAlchemy Core。\r\n",
    "\r\n",
    "So Which one should you use SQLAlchemy Core or ORM?\r\n",
    "\r\n",
    "## 那么您应该使用哪一个 SQLAlchemy Core 或 ORM 呢？\r\n",
    "\r\n",
    "The whole point of having an ORM is to make working with database easy. In the process, it also adds some additional overhead. However, for most applications, this overhead is not much unless you are working with large amounts of data. For most project SQLAlchemy ORM would be enough but If you writing an application where you will be handling a huge amount of data (like in a database warehouse) or you want to have more control over query or you are an SQL purist and prefer to work directly with rows and columns use core.\r\n",
    "\r\n",
    "拥有 ORM 的全部意义在于使得使用数据库更加容易。在这个过程中，它还增加了一些额外的开销。但是，对于大多数应用程序来说，除非要处理大量数据，否则这种开销并不大。对于大多数项目 SQLAlchemy ORM 就足够了，但是如果您编写的应用程序需要处理大量的数据(比如在数据库仓库中) ，或者您希望对查询有更多的控制，或者您是一个 SQL 纯粹主义者，更喜欢直接使用核心来处理行和列。\r\n",
    "\r\n",
    "# Who Uses SQLAlchemy 谁使用 SQLAlchemy\r\n",
    "\r\n",
    "- Reddit\r\n",
    "- Hulu\r\n",
    "- Fedora Project \r\n",
    "- Dropbox\r\n",
    "- OpenStack\r\n",
    "\r\n",
    "and many more. 还有更多。\r\n",
    "\r\n",
    "# Prerequisites: 先决条件:\r\n",
    "In order to go through this tutorial, you should have a basics understanding of Python and SQL. For a quick refresher on Python checkout our Python tutorial https://overiq.com/python-101/intro-to-python/. For SQL search the web.\r\n",
    "\r\n",
    "为了阅读本教程，您应该对 Python 和 SQL 有一个基本的了解。要快速复习 Python，请看我们的 Python 教程 https://overiq.com/python-101/intro-to-python/。对于 SQL 请搜索网页。\r\n",
    "\r\n",
    "Note: The source code of this tutorial is available at https://github.com/overiq/sqlalchemy.\r\n",
    "\r\n",
    "注意: 本教程的源代码可以在 google https://github.com/overiq/sqlalchemy 上找到。"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "本篇纯粹机翻, 机翻效果惊人 /手动狗头 "
   ],
   "metadata": {}
  }
 ],
 "metadata": {
  "orig_nbformat": 4,
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}